package laki.util;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;



public class DatabaseCon {
	public static Connection connection = null;
	
	public Connection databaseConnctor(String username, String password){
		System.out.println("-------- MySQL JDBC Connection Testing ------------");
		 
		try {
 
			Class.forName("com.mysql.jdbc.Driver");
 
		     } catch (ClassNotFoundException e) {
 
			System.out.println("Where is your MySQL JDBC Driver?");
			e.printStackTrace();
			return null;
		    }
 
		System.out.println("MySQL JDBC Driver Registered!");
		//Connection connection = null;
 
		try {
			
			connection = DriverManager
					.getConnection("jdbc:mysql://localhost:3306/mkyongcom",
							username, password);
 
		} catch (SQLException e) {
			System.out.println("Connection Failed! Check output console");
			e.printStackTrace();
		}	
		return connection;
		
	}

}
